package sg.edu.nus.iss.team2s.jass.control;

/**
 * @author Zhang Jinzhong
 */

import java.util.ArrayList;
import java.util.List;

import sg.edu.nus.iss.team2s.jass.dao.DAOException;
import sg.edu.nus.iss.team2s.jass.dao.DAOFactory;
import sg.edu.nus.iss.team2s.jass.dao.DAOInterface;
import sg.edu.nus.iss.team2s.jass.dto.Company;
import sg.edu.nus.iss.team2s.jass.dto.User;
import sg.edu.nus.iss.team2s.jass.gui.JobAdvertDetailScreen;
import sg.edu.nus.iss.team2s.jass.gui.JobAdvertMainScreen;

public class MainController {
	private static User user = null;

	public static User getUser() {
		return user;
	}

	public static void setUser(User user) {
		MainController.user = user;
	}
	
	public static void showJobAdvertDetailScreen(){
		JobAdvertDetailScreen detailScreen = new JobAdvertDetailScreen();
		detailScreen.setVisible(true);
	}
	
	public static void showJobAdvertDetailScreen(String jobAdvertId){
		JobAdvertDetailScreen detailScreen = new JobAdvertDetailScreen(jobAdvertId);
		detailScreen.setVisible(true);
	}
	
	public static List<Company> retrieveAllCompanies(){
		List<Company> companies = new ArrayList<Company>();
		DAOInterface userInterface = (DAOInterface)DAOFactory.getInstance().getDAO(Company.class.getName());
		try {
			userInterface.list();
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return companies;
	}
	
	public static void main(String[] args){

		JobAdvertMainScreen jobAdvertMainScreen = new JobAdvertMainScreen();
		jobAdvertMainScreen.setVisible(true);

	}
}
